package com.yourannet.android;

import com.yourannet.utils.SpeakControl;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class SoundRecordActivity extends Activity implements OnClickListener {
	/**触发录音按钮*/
	private Button btnSoundRecord;
	/**录音控件*/
	SpeakControl m_speakControl = null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sound_record_activity);
		btnSoundRecord = (Button)findViewById(R.id.btnSoundRecord);
		btnSoundRecord.setOnClickListener(this);
		m_speakControl = new SpeakControl(this) {
			public void onRecordCompletion(String path) {
				//Toast.makeText(SoundRecordActivity.this, "录音完毕", Toast.LENGTH_LONG).show();
			};
		};
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		if (null != m_speakControl) {
			m_speakControl.release();
		}
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.btnSoundRecord:
			//选择了录音，进入录音界面
			m_speakControl.speakDialogShow();
			break;
		}
	}

}
